﻿using Unity.UIWidgets.engine;
using Unity.UIWidgets.widgets;
using UIWidgetsSample;
using Unity.UIWidgets.painting;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.material;

public class Test_UIWidgets_1 : UIWidgetsPanel
{
    protected override Widget createWidget()
    {
        return new Counter();
    }

    class Counter : StatefulWidget
    {
        public override State createState()
        {
            return new CounterState();
        }
    }

    class CounterState : State<Counter>
    {
        public int Count { get; private set; } = 0;
        public override Widget build(BuildContext context)
        {
            return new CustomButton(
                child: new Text(data: "Counter : " + Count, style: new TextStyle(color: Colors.red, fontSize: 30)),
                onPressed: () =>
                {
                    //Count++;
                    //(context as StatefulElement).markNeedsBuild();
                    setState(() => Count++);
                }
            );
        }
    }
}
